﻿using KouDai.WinPad.Models;
using System.Diagnostics;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace KouDai.WinPad.Controls
{
    public class ShellDataTemplateSelector : DataTemplateSelector
    {
        public DataTemplate ImageTemplate { get; set; }
        public DataTemplate CategoryTemplate { get; set; }


        protected override Windows.UI.Xaml.DataTemplate SelectTemplateCore(object item, Windows.UI.Xaml.DependencyObject container)
        {
            HoneyEntity honeyItem = (HoneyEntity)item;
            //Debug.WriteLine("imageurl:" + honeyItem.ImageUrlForIphone);
            if (honeyItem.ImageUrlForIphone.Contains("Images"))
            {
                return this.CategoryTemplate;
            }
            else
            {
                return this.ImageTemplate;
            }
        }
    }
}
